package com.atguigu.guli.service.vod.controller;

import com.atguigu.guli.service.base.result.R;
import com.atguigu.guli.service.vod.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

@RestController
@RequestMapping("/admin/vod")
public class UploadVideoController {
    @Autowired
    UploadService uploadService;

    @PostMapping("upload")
    public R uploadVideo(@RequestParam MultipartFile file){
    Map map =  uploadService.upload(file);
        return R.ok().data("maps",map);
    }
    //获取播放凭证
    @GetMapping("getPlayAuth/{id}")
    public R getPlayAuth(@PathVariable String id){
       Map auth =  uploadService.getPlayAuth(id);
       return R.ok().data("item",auth);
    }

}
